<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns="http://www.w3.org/1999/xhtml">
  <xsl:output method="xml" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
  doctype-system= "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" />
  <xsl:template match="/">    
	<html xmlns="http://www.w3.org/1999/xhtml">
      <head>
      	<title>Calendar</title>
      	<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
      	<style type="text/css">
   			td, table, tr, th {border: 1px solid black;}
   			table {empty-cells: show;}
   			td {text-align: center}
   			.taken {background-color: #33FF33;}
   			th {background-color: #FFCC00}
 		</style>
      </head>
      <body>
      	<table>
      	<tr>
      		<th> </th><th>Sunday</th><th>Monday</th><th>Tuesday</th><th>Wednesday</th><th>Thursday</th><th>Friday</th><th>Saturday</th>
      	</tr>
      		<xsl:for-each select="timetable/hour">
      			<tr>
	      			<td>
	      				<xsl:value-of select="@number" />
	      			</td>
      				<xsl:for-each select="day">
      					<td>
      						<xsl:attribute name="rowspan">
    							<xsl:value-of select="duration" />
							</xsl:attribute>
							<xsl:if test="duration != ''">
    							<xsl:attribute name="class">taken</xsl:attribute>
							</xsl:if>
							<xsl:value-of select="courseName" />
						</td>
      				</xsl:for-each>
      			</tr>
      		</xsl:for-each>
      	</table>
      </body>
    </html>
   </xsl:template>


</xsl:stylesheet>
